#include "insertdata.h"
#include <QTextStream>
#include <QTextCodec>
#include <QJsonArray>
#include <QJsonParseError>
#include <QJsonValue>

QString insertdata::insertjson()
{
    QJsonObject json;
    json.insert("deviceId","001");     //设备编号;
    json.insert("platformId","2");      //渠道标号
    json.insert("queryType","3");       //访问类型-3代表获取首界面引导语
    json.insert("query","12");
    json.insert("messageId","001");
    QJsonDocument jsonDoc;
    //将对象设置为本文档的主要对象 /若为数组 将数组设置为本文档的主要对象。 /返回文档中包含的QJsonObject。如果文档包含数组，则返回空对象。
    jsonDoc.setObject(json);
    //将QJsonDocument转换为提供格式的UTF-8编码JSON文档
    //该值定义了使用toJson()转换为QJsonDocument时生成的JSON字节数组的格式。
    //定义人类可读输出如下: 值 = 0
    QByteArray jsonArrind = jsonDoc.toJson(QJsonDocument::Indented);
    qDebug() << QString::fromUtf8(jsonArrind);
    //定义一个紧凑的输出如下:值 = 1
    QByteArray jsonArr = jsonDoc.toJson(QJsonDocument::Compact);
    qDebug() << QString::fromUtf8(jsonArr) ;

    return QString::fromUtf8(jsonArr);
}
 void insertdata::ReadJSONFile(QString filePath)
 {
    qDebug() << "文件路径 " << filePath;
    QFile file(filePath);
    if(!file.open(QIODevice::ReadOnly))
    {
        qDebug() << "FAIL";
         return;
    }
    QByteArray Data = file.readAll();
    file.close();
    //ByteArray 转为JSONDOC
    QJsonDocument jsonDocument =QJsonDocument::fromJson(Data);
    QByteArray formatJson = jsonDocument.toJson(QJsonDocument::Indented);
    QString str = QString::fromUtf8(formatJson);
    qDebug() << "";
    qDebug() << "================格式化JSON数据 便于查看 ===================";
    qDebug() << str;
    qDebug() << "==============  格式化JSON显示结束 ========================";

    QJsonParseError json_error;
    QJsonDocument jsonDoc(QJsonDocument::fromJson(Data,&json_error));
    if(jsonDoc.isNull() ||json_error.error != QJsonParseError::NoError)
    {
        qDebug() << "json error";
        return;
    }
    QJsonObject rootObj;
    rootObj = jsonDoc.object();
    //显示 JSON数据中key值
    qDebug() << "################ JSON数据中key###############################";
    QStringList keys = rootObj.keys();
    for(int i=0; i<keys.size(); i++)
    {
        qDebug() << QString("key[%1]").arg(i) << " = " << keys.at(i);
    }
    qDebug() << "################ UnpackRecommendJsonData###############################";
    //UnpackRecommendJsonData(rootObj);
    UnPackText(rootObj);
    //return rootObj;

 }

 //解析首界面引导语JSON数据
 void insertdata::UnpackGuidingJsonData(QJsonObject& JsonObj)
 {
     QJsonObject richTextObj;

     if (!getJsonTagValue(JsonObj,"richText",richTextObj))
     {
         qDebug("STP_HTTP_GetQueryList_RESP: Get Tag richText Value failed!");
     }
     else
     {
         //获取richType
         QString strRichType = "";
         if (!getJsonTagValue(richTextObj,"richType",strRichType))
         {
             qDebug("STP_HTTP_GetQueryList_RESP:Get Tag richType Value failed!");
         }
         if ("guiding" != strRichType)
         {
             qDebug("STP_HTTP_GetQueryList_RESP: RichType != guiding Retrun Failed!");
         }

         QJsonObject richContentObj;
         if (!getJsonTagValue(richTextObj,"richContent",richContentObj))
         {
             qDebug("STP_HTTP_GetQueryList_RESP: Get Tag richContent Value failed!");
         }
         else
         {
             //获取tts
             QString strTts = "";
             if (!getJsonTagValue(richContentObj,"tts",strTts))
             {
                 qDebug("STP_HTTP_GetQueryList_RESP: Get Tag tts Value failed!");
             }


             //获取screenShow
             QString strScreenShow = "";
             if (!getJsonTagValue(richContentObj,"screenShow",strScreenShow))
             {
                 qDebug("STP_HTTP_GetQueryList_RESP: Get Tag screenShow Value failed!");
             }

             //获取word
             QJsonArray arrWord;
             QString strWord = "";
             if (!getJsonTagValue(richContentObj,"word",arrWord))
             {
                 qDebug("STP_HTTP_GetQueryList_RESP: Get Tag word Value failed!");
             }
             for (int i = 0; i < arrWord.size(); i++)
             {
                 strWord = strWord + arrWord.at(i).toString() + "|";
             }
             if (strWord.length() >= 1)
             {
                 strWord = strWord.left(strWord.length() - 1);
             }

             //获取imageUrl
             QJsonArray arrImageUrl;
             QString strImageUrl = "";
             if (!getJsonTagValue(richContentObj,"imageUrl",arrImageUrl))
             {
                 qDebug("STP_HTTP_GetQueryList_RESP: Get Tag imageUrl Value failed!");
             }
             qDebug() <<QString("strImageUrl = %1").arg(strImageUrl);
             for (int i = 0; i < arrImageUrl.size(); i++)
             {
                 strImageUrl = strImageUrl + arrImageUrl.at(i).toString() + "|";
             }
             if (strImageUrl.length() >= 1)
             {
                 strImageUrl = strImageUrl.left(strImageUrl.length() - 1);
             }
             qDebug() << QString("strWord = %1").arg(strWord);
         }
     }
 }

 //解析推荐问题JSON数据
 void insertdata::UnpackRecommendJsonData(QJsonObject& JsonObj)
 {
     QJsonObject recommendTextObj;
     if (!getJsonTagValue(JsonObj,"recommendText",recommendTextObj))
     {
         qDebug("STP_HTTP_QueryType_1_RESP: Get Tag recommendText Value failed!");
     }
     else
     {
         //获取tts
         QString strTts = "";
         if (!getJsonTagValue(recommendTextObj,"tts",strTts))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag tts Value failed!");
         }
         qDebug() << "RP_A01_Recommed_tts = " << strTts;

         //获取screenShow
         QString strScreenShow = "";
         if (!getJsonTagValue(recommendTextObj,"screenShow",strScreenShow))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag screenShow Value failed!");
         }
         qDebug() <<"RP_A01_Recommed_screenShow = " << strScreenShow;
         //SetValue("RP_A01_Recommed_screenShow",);
         //InfoLog(QString("%1").arg(GetValue("RP_A01_Recommed_screenShow")));

         //获取recommondMsg
         QString strRecommondMsg = "";
         if (!getJsonTagValue(recommendTextObj,"recommondMsg",strRecommondMsg))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag recommondMsg Value failed!");
         }
         qDebug() << "RP_A01_Recommed_recommondMsg =" <<strRecommondMsg;
         //SetValue("RP_A01_Recommed_recommondMsg",);
         //InfoLog(QString(" %1").arg(GetValue("RP_A01_Recommed_recommondMsg")));

         //获取backGroundImgUrl
         QString strBackGroundImgUrl = "";
         if (!getJsonTagValue(recommendTextObj,"backGroundImgUrl",strBackGroundImgUrl))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag backGroundImgUrl Value failed!");
         }
         qDebug() << "RP_A01_Recommed_backGroundImgUrl =" <<strBackGroundImgUrl;
         //SetValue("RP_A01_Recommed_backGroundImgUrl",);
         //InfoLog(QString(" %1").arg(GetValue("RP_A01_Recommed_backGroundImgUrl")));

         //获取questionList
         QJsonArray arrQuestionList;
         QString strQuestionList = "";
         if (!getJsonTagValue(recommendTextObj,"questionList",arrQuestionList))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag questionList Value failed!");
         }
         for (int i = 0; i < arrQuestionList.size(); i++)
         {
             strQuestionList = strQuestionList + arrQuestionList.at(i).toString() + "|";
         }
         if (strQuestionList.length() >= 1)
         {
             strQuestionList = strQuestionList.left(strQuestionList.length() - 1);
         }
         //
         qDebug() << "RP_A01_Recommed_questionList =" << strQuestionList;
         //SetValue("RP_A01_Recommed_questionList",);
         //InfoLog(QString(" %1").arg(GetValue("RP_A01_Recommed_questionList")));

         //获取btnCancel
         QJsonObject btnCancelObj;
         if (!getJsonTagValue(recommendTextObj,"btnCancel",btnCancelObj))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCancel Value failed!");
         }
         else
         {
             //获取isShow
             QString strIsShow = "";
             if (!getJsonTagValue(btnCancelObj,"isShow",strIsShow))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCancel/isShow Value failed!");
             }
             qDebug() <<"RP_A01_Recommed_btnCancel_isShow = " <<strIsShow;
            // SetValue("RP_A01_Recommed_btnCancel_isShow",);
             //InfoLog(QString("%1").arg(GetValue("RP_A01_Recommed_btnCancel_isShow")));

             //获取textShow
             QString strTextShow = "";
             if (!getJsonTagValue(btnCancelObj,"textShow",strTextShow))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCancel/textShow Value failed!");
             }
             //
             qDebug() << "RP_A01_Recommed_btnCancel_textShow =" << strTextShow;
             //SetValue("RP_A01_Recommed_btnCancel_textShow",);
             //InfoLog(QString("%1").arg(GetValue("RP_A01_Recommed_btnCancel_textShow")));

             //获取imgUrl
             QString strImgUrl = "";
             if (!getJsonTagValue(btnCancelObj,"imgUrl",strImgUrl))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCancel/imgUrl Value failed!");
             }
             //
             qDebug() << "RP_A01_Recommed_btnCancel_imgUrl =" << strImgUrl;
             //SetValue("RP_A01_Recommed_btnCancel_imgUrl",);
             //InfoLog(QString(" %1").arg(GetValue("RP_A01_Recommed_btnCancel_imgUrl")));

             //获取goMessage
             QString strGoMessage = "";
             if (!getJsonTagValue(btnCancelObj,"goMessage",strGoMessage))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCancel/goMessage Value failed!");
             }
              qDebug() << "RP_A01_Recommed_btnCancel_goMessage =" <<strGoMessage;
             //SetValue("RP_A01_Recommed_btnCancel_goMessage",);
             //InfoLog(QString(" %1").arg(GetValue("RP_A01_Recommed_btnCancel_goMessage")));
         }
     }
 }
 //解析广告界面
 void UnpackAdvertJsonData(QJsonObject& JsonObj)
 {

 }


QString insertdata::UnPackText(QJsonObject& JsonObj)
{
    QString strAnswerId = "";
    if (!getJsonTagValue(JsonObj,"answerId",strAnswerId))
    {
        qDebug("STP_HTTP_QueryType_1_RESP: Get Tag answerId Value failed!");
        //return "STA_UNPACKERR";
        qDebug() << "STA_UNPACKERR";
        return "";
    }
    else
    {
        if ("2" == strAnswerId.trimmed())
        {
            //推荐问题
            UnpackRecommendJsonData(JsonObj);
            qDebug() << "STA_ROBT_RECOMMED";

            return "";
            //return "STA_ROBT_RECOMMED";
        }
        else if ("3" == strAnswerId.trimmed())
        {
            //空答案(机器人不播报,页面不刷新，只更新用户说的话)
            qDebug() << "STA_NOACTION";
            return "";
        }
        else if ("1" == strAnswerId.trimmed())
        {
            QJsonObject richTextObj;
            if (!getJsonTagValue(JsonObj,"richText",richTextObj))
            {
                qDebug("STP_HTTP_QueryType_1_RESP: Get Tag richTextObj Value failed!");
                //return "STA_UNPACKERR";
                qDebug() << "STA_UNPACKERR";
                return "";
            }
            else
            {
                //获取richType
                QString strRichType = "";
                if (!getJsonTagValue(richTextObj,"richType",strRichType))
                {
                    qDebug("STP_HTTP_QueryType_1_RESP:Get Tag richType Value failed!");
                    //return "STA_UNPACKERR";
                    qDebug() << "STA_UNPACKERR";
                    return "";
                }
                if ("scene" == strRichType)
                {
                    QJsonObject textCmdObj;
                    if (!getJsonTagValue(JsonObj,"textCmd",textCmdObj))
                    {
                        qDebug("STP_HTTP_QueryType_1_RESP: Get Tag richTextObj Value failed!");
                        //return "STA_UNPACKERR";
                        qDebug() << "STA_UNPACKERR";
                        return "";
                    }
                    else
                    {
                        QString strTextCmd_type = "";
                        if (!getJsonTagValue(textCmdObj,"type",strTextCmd_type))
                        {
                            qDebug("STP_HTTP_QueryType_1_RESP: Get Tag textCmd/type Value failed!");
                            //return "STA_UNPACKERR";
                            qDebug() << "STA_UNPACKERR";
                            return "";
                        }
                        //此处处理
                        qDebug() << "RP_A01_TextCmd_type111 =" <<strTextCmd_type;
                        //SetValue("RP_A01_TextCmd_type",strTextCmd_type.trimmed());
                        //InfoLog(QString("RP_A01_TextCmd_type = %1").arg(GetValue("RP_A01_TextCmd_type")));
                        //InfoLog(QString("RP_A01_TextCmd_type = %1").arg(GetValue("RP_A01_TextCmd_type")));
                        QString strTextCmd_value = "";
                        if (!getJsonTagValue(textCmdObj,"value",strTextCmd_value))
                        {
                            qDebug("STP_HTTP_QueryType_1_RESP: Get Tag textCmd/value Value failed!");
                            //return "STA_UNPACKERR";
                            qDebug() << "STA_UNPACKERR";
                            return "";
                        }
                        qDebug() << "RP_A01_TextCmd_value =" << strTextCmd_value;
                        QStringList ROBTActionList;
                        ROBTActionList <<"start_music" <<"music_change"<< "stop_music" \
                                       <<"joke" << "start_loud" <<"start_lowvoice" <<"strat_dance"\
                                       <<"stop_dance"<<"start_box" << "start_flyairplane" \
                                       <<"start_sleep"<<"start_kiss" <<"start_drive"<<"start_handshake"
                                       <<"strat_playguitar"<<"salute"<<"selfcharging"<<"start_walk"<<"walk_s"\
                                       <<"left_walk" <<"right_walk" << "stop_walk" <<"continue_walk"<<"walk_point"\
                                       <<"walk_tour";
                        if(ROBTActionList.contains(strTextCmd_type.trimmed()))
                        {
                            //UnpackSceneJsonData
                            UnpackSceneJsonData(richTextObj);
                            //return "STA_ROBT_ACTION";
                            qDebug() << "STA_ROBT_ACTION";
                            return "";
                        }
                        QStringList cmdList1;
                        cmdList1 << "xiugaimima";
                        if(cmdList1.contains(strTextCmd_type))
                        {
                            qDebug() <<"goto WASP"<<strTextCmd_type ;
                            return "";
                        }
                    }
                    //富文本问答交互
                    UnpackSceneJsonData(richTextObj);
                    //return "STA_INTERACTION";
                    qDebug() << "STA_INTERACTION";
                    return "";
                }
                else if ("queue" == strRichType)
                {
                    //排队机
                    //UnpackQueueJsonData(richTextObj);
                    //return "STA_ROBT_QUEUE";
                    qDebug() << "STA_ROBT_QUEUE";
                    return "";
                }
                else if ("guiding" == strRichType)
                {
                    //返回首页
                    UnpackGuidingJsonData(JsonObj);
                    //return STA_CANCEL;
                    qDebug() << "STA_CANCEL";
                    return "";
                }
                else
                {
                    qDebug("STP_HTTP_QueryType_1_RESP: RichType != scene or queue Retrun Failed!");
                    //return "STA_UNPACKERR";
                    qDebug() << "STA_UNPACKERR";
                    return "";
                }
            }
        }
    }
    return "";

}


//##################################################################### o根据类型解析
 //QString类型
 bool insertdata::getJsonTagValue(const QJsonObject &obj,const QString &strTagName,QString &strTagValueOut)
 {
     qDebug() << strTagName;
     qDebug() << "obj QString类型 " << obj.find(strTagName).value();
     //遍历JSON数据值类型
     switch (obj.find(strTagName).value().type())
     {
         case QJsonValue::String:
         {
             strTagValueOut = obj.find(strTagName).value().toString();
             return true;
         }
         case QJsonValue::Null:
         {
             strTagValueOut = "Null";
             return true;
         }
         case QJsonValue::Undefined:
         {
             strTagValueOut = "";
             return true;
         }
         default:
         {
             qDebug("TagValue is not String,return false!");
             return false;
         }
     }
 }
 //Array类型
 bool insertdata::getJsonTagValue(const QJsonObject &obj,const QString &strTagName,QJsonArray &JsonArrOut)
 {
     qDebug() << strTagName;
     qDebug() << "obj  Array类型" << obj.find(strTagName).value();
     switch (obj.find(strTagName).value().type())
     {
         case QJsonValue::Array:
         {
             JsonArrOut = obj.find(strTagName).value().toArray();
             return true;
         }
         default:
         {
             qDebug("TagValue is not Array,return false!");
             return false;
         }
     }
 }
 //QJsonObject类型
 bool insertdata::getJsonTagValue(const QJsonObject &obj,const QString &strTagName,QJsonObject &objOut)
 {
     qDebug() << strTagName;
     qDebug() << "obj QJsonObject类型" << obj.find(strTagName).value();
     switch (obj.find(strTagName).value().type())
     {
         case QJsonValue::Object:
         {
             objOut = obj.find(strTagName).value().toObject();
             return true;
         }
         default:
         {
             qDebug("TagValue is not QJsonObject,return false!");
             return false;
         }
     }
 }

 //bool类型
 bool insertdata::getJsonTagValue(const QJsonObject &obj,const QString &strTagName,bool &bOut)
 {
     qDebug() << strTagName;
     qDebug() << "obj bool类型" << obj.find(strTagName).value();
     switch (obj.find(strTagName).value().type())
     {
         case QJsonValue::Bool:
         {
             bOut = obj.find(strTagName).value().toBool();
             return true;
         }
         default:
         {
             qDebug("strTagValue is not Bool,return false!");
             return false;
         }
     }
 }

 //double类型
 bool insertdata::getJsonTagValue(const QJsonObject &obj,const QString &strTagName,double &douOut)
 {   qDebug() << strTagName;
     qDebug() << "obj double类型" << obj.find(strTagName).value();
     switch (obj.find(strTagName).value().type())
     {
         case QJsonValue::Double:
         {
             douOut = obj.find(strTagName).value().toDouble();
             return true;
         }
         default:
         {
             qDebug("strTagValue is not Doublle,return false!");
             return false;
         }
     }
 }

 //解析富文本标准答案类型JSON数据
 void insertdata::UnpackSceneJsonData(QJsonObject& JsonObj)
 {
     QJsonObject richContentObj;
     if (!getJsonTagValue(JsonObj,"richContent",richContentObj))
     {
         qDebug("STP_HTTP_QueryType_1_RESP: Get Tag richContent Value failed!");
     }
     else
     {
         //获取tts
         QString strTts = "";
         if (!getJsonTagValue(richContentObj,"tts",strTts))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag tts Value failed!");
         }

         qDebug()<<"RP_A01_tts =" << strTts;

         //获取screenShow
         QString strScreenShow = "";
         if (!getJsonTagValue(richContentObj,"screenShow",strScreenShow))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag screenShow Value failed!");
         }
         qDebug()<<"RP_A01_screenShow =" << strScreenShow;

         //获取btnCenters
         QJsonObject btnCentersObj;
         if (!getJsonTagValue(richContentObj,"btnCenters",btnCentersObj))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCenters Value failed!");
         }
         else
         {
             //获取images
             QJsonArray arrImages;
             if (!getJsonTagValue(btnCentersObj,"images",arrImages))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCenters/images Value failed!");
             }
             else
             {
                 QString strIsShow = "";       //isShow
                 QString strImgUrl = "";       //imgUrl
                 for (int i = 0; i < arrImages.size(); i++)
                 {
                     //获取isShow
                     QString strTmpIsShow = "";
                     if (!getJsonTagValue(arrImages.at(i).toObject(),"isShow",strTmpIsShow))
                     {
                         qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCenters/images/isShow Value failed!");
                     }
                     strIsShow = strIsShow + strTmpIsShow + "|";

                     //获取imgUrl
                     QString strTmpImgUrl = "";
                     if (!getJsonTagValue(arrImages.at(i).toObject(),"imgUrl",strTmpImgUrl))
                     {
                         qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCenters/images/imageUrl Value failed!");
                     }
                     strImgUrl = strImgUrl + strTmpImgUrl + "|";
                 }
                 //isShow
                 if (strIsShow.length() >= 1)
                 {
                     strIsShow = strIsShow.left(strIsShow.length() - 1);
                 }
                 qDebug() <<"RP_A01_btnCenters_images_isShow =" <<strIsShow;
                 //imgUrl
                 if (strImgUrl.length() >= 1)
                 {
                     strImgUrl = strImgUrl.left(strImgUrl.length() - 1);
                 }
                 qDebug() <<"RP_A01_btnCenters_images_imgUrl =" <<strImgUrl;

             }

             //获取buttons
             QJsonArray arrButtons;
             if (!getJsonTagValue(btnCentersObj,"buttons",arrButtons))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag buttons Value failed!");
             }
             else
             {
                 QString strButtons_IsShow    = "";       //isShow
                 QString strButtons_TextShow  = "";       //textShow
                 QString strButtons_ImgUrl    = "";       //imgUrl
                 QString strButtons_GoMessage = "";       //goMessage
                 for (int i = 0; i < arrButtons.size(); i++)
                 {
                     //获取isShow
                     QString strTmpButtons_IsShow = "";
                     if (!getJsonTagValue(arrButtons.at(i).toObject(),"isShow",strTmpButtons_IsShow))
                     {
                         qDebug("STP_HTTP_QueryType_1_RESP: Get Tag buttons/isShow Value failed!");
                     }
                     strButtons_IsShow = strButtons_IsShow + strTmpButtons_IsShow + "|";

                     //获取TextShow
                     QString strTmpButtons_TextShow = "";
                     if (!getJsonTagValue(arrButtons.at(i).toObject(),"textShow",strTmpButtons_TextShow))
                     {
                         qDebug("STP_HTTP_QueryType_1_RESP: Get Tag buttons/textShow Value failed!");
                     }
                     strButtons_TextShow = strButtons_TextShow + strTmpButtons_TextShow + "|";

                     //获取imgUrl
                     QString strTmpButtons_ImgUrl = "";
                     if (!getJsonTagValue(arrButtons.at(i).toObject(),"imgUrl",strTmpButtons_ImgUrl))
                     {
                         qDebug("STP_HTTP_QueryType_1_RESP: Get Tag buttons/imageUrl Value failed!");
                     }
                     strButtons_ImgUrl = strButtons_ImgUrl + strTmpButtons_ImgUrl + "|";

                     //获取goMessage
                     QString strTmpButtons_GoMessage = "";
                     if (!getJsonTagValue(arrButtons.at(i).toObject(),"goMessage",strTmpButtons_GoMessage))
                     {
                         qDebug("STP_HTTP_QueryType_1_RESP: Get Tag buttons/goMessage Value failed!");
                     }
                     strButtons_GoMessage = strButtons_GoMessage + strTmpButtons_GoMessage + "|";
                 }
                 //isShow
                 if (strButtons_IsShow.length() >= 1)
                 {
                     strButtons_IsShow = strButtons_IsShow.left(strButtons_IsShow.length() - 1);
                 }
                 qDebug() << "RP_A01_btnCenters_buttons_isShow =" <<strButtons_IsShow;
                 //textShow
                 if (strButtons_TextShow.length() >= 1)
                 {
                     strButtons_TextShow = strButtons_TextShow.left(strButtons_TextShow.length() - 1);
                 }
                 qDebug() << "RP_A01_btnCenters_buttons_textShow =" <<strButtons_TextShow;
                 //imgUrl
                 if (strButtons_ImgUrl.length() >= 1)
                 {
                     strButtons_ImgUrl = strButtons_ImgUrl.left(strButtons_ImgUrl.length() - 1);
                 }
                 qDebug() << "RP_A01_btnCenters_buttons_imgUrl =" <<strButtons_ImgUrl;
                 //goMessage
                 if (strButtons_GoMessage.length() >= 1)
                 {
                     strButtons_GoMessage = strButtons_GoMessage.left(strButtons_GoMessage.length() - 1);
                 }
                 qDebug() << "RP_A01_btnCenters_buttons_goMessage =" <<strButtons_GoMessage;
             }

         }

         //获取btnBottoms
         QJsonArray arrBtnBottoms;
         if (!getJsonTagValue(richContentObj,"btnBottoms",arrBtnBottoms))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnBottoms Value failed!");
         }
         else
         {
             QString strBtnBottoms_IsShow    = "";       //isShow
             QString strBtnBottoms_TextShow  = "";       //textShow
             QString strBtnBottoms_ImgUrl    = "";       //imgUrl
             QString strBtnBottoms_GoMessage = "";       //goMessage
             for (int i = 0; i < arrBtnBottoms.size(); i++)
             {
                 //获取isShow
                 QString strTmpBtnBottoms_IsShow = "";
                 if (!getJsonTagValue(arrBtnBottoms.at(i).toObject(),"isShow",strTmpBtnBottoms_IsShow))
                 {
                     qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnBottoms/isShow Value failed!");
                 }
                 strBtnBottoms_IsShow = strBtnBottoms_IsShow + strTmpBtnBottoms_IsShow + "|";

                 //获取TextShow
                 QString strTmpBtnBottoms_TextShow = "";
                 if (!getJsonTagValue(arrBtnBottoms.at(i).toObject(),"textShow",strTmpBtnBottoms_TextShow))
                 {
                     qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnBottoms/textShow Value failed!");
                 }
                 strBtnBottoms_TextShow = strBtnBottoms_TextShow + strTmpBtnBottoms_TextShow + "|";

                 //获取imgUrl
                 QString strTmpBtnBottoms_ImgUrl = "";
                 if (!getJsonTagValue(arrBtnBottoms.at(i).toObject(),"imgUrl",strTmpBtnBottoms_ImgUrl))
                 {
                     qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnBottoms/imageUrl Value failed!");
                 }
                 strBtnBottoms_ImgUrl = strBtnBottoms_ImgUrl + strTmpBtnBottoms_ImgUrl + "|";

                 //获取goMessage
                 QString strTmpBtnBottoms_GoMessage = "";
                 if (!getJsonTagValue(arrBtnBottoms.at(i).toObject(),"goMessage",strTmpBtnBottoms_GoMessage))
                 {
                     qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnBottoms/goMessage Value failed!");
                 }
                 strBtnBottoms_GoMessage = strBtnBottoms_GoMessage + strTmpBtnBottoms_GoMessage + "|";
             }
             //isShow
             if (strBtnBottoms_IsShow.length() >= 1)
             {
                 strBtnBottoms_IsShow = strBtnBottoms_IsShow.left(strBtnBottoms_IsShow.length() - 1);
             }
             qDebug() << "RP_A01_btnBottoms_isShow =" << strBtnBottoms_IsShow;
             //textShow
             if (strBtnBottoms_TextShow.length() >= 1)
             {
                 strBtnBottoms_TextShow = strBtnBottoms_TextShow.left(strBtnBottoms_TextShow.length() - 1);
             }
             qDebug() << "RP_A01_btnBottoms_textShow =" << strBtnBottoms_TextShow;
             //imgUrl
             if (strBtnBottoms_ImgUrl.length() >= 1)
             {
                 strBtnBottoms_ImgUrl = strBtnBottoms_ImgUrl.left(strBtnBottoms_ImgUrl.length() - 1);
             }
             qDebug() << "RP_A01_btnBottoms_imgUrl =" << strBtnBottoms_ImgUrl;
             //goMessage
             if (strBtnBottoms_GoMessage.length() >= 1)
             {
                 strBtnBottoms_GoMessage = strBtnBottoms_GoMessage.left(strBtnBottoms_GoMessage.length() - 1);
             }
             qDebug() << "RP_A01_btnBottoms_goMessage =" << strBtnBottoms_GoMessage;
         }

         //获取btnPre
         QJsonObject btnPreObj;
         if (!getJsonTagValue(richContentObj,"btnPre",btnPreObj))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnPre Value failed!");
         }
         else
         {
             //获取tts
             QString strBtnPre_IsShow = "";
             if (!getJsonTagValue(btnPreObj,"isShow",strBtnPre_IsShow))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnPre/isShow Value failed!");
             }
             qDebug() << "RP_A01_btnPre_isShow =" << strBtnPre_IsShow;


             //获取textShow
             QString strBtnPre_TextShow = "";
             if (!getJsonTagValue(btnPreObj,"textShow",strBtnPre_TextShow))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnPre/textShow Value failed!");
             }
             qDebug() << "RP_A01_btnPre_textShow =" << strBtnPre_TextShow;

             //获取imgUrl
             QString strBtnPre_ImgUrl = "";
             if (!getJsonTagValue(btnPreObj,"imgUrl",strBtnPre_ImgUrl))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnPre/imgUrl Value failed!");
             }
             qDebug() << "RP_A01_btnPre_imgUrl =" << strBtnPre_ImgUrl;

             //获取goMessage
             QString strBtnPre_GoMessage = "";
             if (!getJsonTagValue(btnPreObj,"goMessage",strBtnPre_GoMessage))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnPre/goMessage Value failed!");
             }
             qDebug() << "RP_A01_btnPre_goMessage =" << strBtnPre_GoMessage;
         }

         //获取btnNext
         QJsonObject btnNextObj;
         if (!getJsonTagValue(richContentObj,"btnNext",btnNextObj))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnNext Value failed!");
         }
         else
         {
             //获取tts
             QString strBtnNext_IsShow = "";
             if (!getJsonTagValue(btnNextObj,"isShow",strBtnNext_IsShow))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnNext/isShow Value failed!");
             }
             qDebug() << "RP_A01_btnNext_isShow =" << strBtnNext_IsShow;

             //获取textShow
             QString strBtnNext_TextShow = "";
             if (!getJsonTagValue(btnNextObj,"textShow",strBtnNext_TextShow))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnNext/textShow Value failed!");
             }
             qDebug() << "RP_A01_btnNext_textShow =" << strBtnNext_TextShow;

             //获取imgUrl
             QString strBtnNext_ImgUrl = "";
             if (!getJsonTagValue(btnNextObj,"imgUrl",strBtnNext_ImgUrl))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnNext/imgUrl Value failed!");
             }
             qDebug() << "RP_A01_btnNext_imgUrl =" << strBtnNext_ImgUrl;

             //获取goMessage
             QString strBtnNext_GoMessage = "";
             if (!getJsonTagValue(btnNextObj,"goMessage",strBtnNext_GoMessage))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnNext/goMessage Value failed!");
             }
             qDebug() << "RP_A01_btnNext_goMessage =" << strBtnNext_GoMessage;
         }

         //获取btnCancel
         QJsonObject btnCancelObj;
         if (!getJsonTagValue(richContentObj,"btnCancel",btnCancelObj))
         {
             qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCancel Value failed!");
         }
         else
         {
             //获取tts
             QString strBtnCancel_IsShow = "";
             if (!getJsonTagValue(btnCancelObj,"isShow",strBtnCancel_IsShow))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCancel/isShow Value failed!");
             }
             qDebug() << "RP_A01_btnCancel_isShow =" << strBtnCancel_IsShow;

             //获取textShow
             QString strBtnCancel_TextShow = "";
             if (!getJsonTagValue(btnCancelObj,"textShow",strBtnCancel_TextShow))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCancel/textShow Value failed!");
             }
             qDebug() << "RP_A01_btnCancel_textShow =" << strBtnCancel_TextShow;

             //获取imgUrl
             QString strBtnCancel_ImgUrl = "";
             if (!getJsonTagValue(btnCancelObj,"imgUrl",strBtnCancel_ImgUrl))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCancel/imgUrl Value failed!");
             }
             qDebug() << "RP_A01_btnCancel_imgUrl =" << strBtnCancel_ImgUrl;

             //获取goMessage
             QString strBtnCancel_GoMessage = "";
             if (!getJsonTagValue(btnCancelObj,"goMessage",strBtnCancel_GoMessage))
             {
                 qDebug("STP_HTTP_QueryType_1_RESP: Get Tag btnCancel/goMessage Value failed!");
             }
             qDebug() << "RP_A01_btnCancel_goMessage =" << strBtnCancel_GoMessage;
         }
     }
 }

